<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>
<script>
spellcheck_test(
    [
      '<div id="container" spellcheck="false">',
        '<div>|asd is misspelled.</div>',
      '</div>'
    ].join(''),
    document => {
      document.designMode = 'on';
      document.getSelection().modify('move', 'forward', 'word');
    },
    [
      '<div id="container" spellcheck="false">',
        '<div>asd is misspelled.</div>',
      '</div>'
    ].join(''),
    {
      title: 'No spelling marker in designMode when spellcheck=false.',
      callback: sample => spellcheck_test(
          sample,
          document => {
            document.getElementById('container').setAttribute('spellcheck', 'true');
            // Do any selection change to force spellchecking after attribute change.
            document.getSelection().modify('move', 'forward', 'line');
          },
          [
            '<div id="container" spellcheck="true">',
              '<div>#asd# is misspelled.</div>',
            '</div>'
          ].join(''),
          'Spelling marker appears when changing spellcheck from false to true.')
    });
</script>
